package com.liang.rabbitmq.controller;

import com.liang.rabbitmq.pojo.OrderEntity;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RabbitController {
    @Autowired
    RabbitTemplate rabbitTemplate;

    @GetMapping("/sendMsg")
    public String sendMsg(){
        OrderEntity orderEntity = new OrderEntity();
        orderEntity.setId(8L);
        orderEntity.setName("kdlasndlaklk斯乃纳");
        rabbitTemplate.convertAndSend("hello.exchange","hello",orderEntity);
        return "ok";
    }



}
